//============================================================================
// Name        : RegionFinder.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <string>
#include <sstream>

#define LEFT_NULL_COLON 0xFFBFEFFBFELLU;
#define RIGHT_NULL_COLON 0x7FDFF7FDFFLLU;
#define TOP_NULL_ROW 0x3FFFFFFFFFFFFLLU;
#define BOTTOM_NULL_ROW 0xFFFFFFFFFFFFC00LLU;



using namespace std;
string convBase(unsigned long v, long base)
{
	string digits = "0123456789abcdef";
	string result;
	string te="";
	int count=20;
	ostringstream out;
	if((base < 2) || (base > 16)) {
		result = "Error: base out of range.";
	}
	else {

		do {

			result = digits[v % base] + result;
			v /= base;
		}
		while(v);
	}
	//count=60-result.size();
	//out<<digits[count];

	//for (int l=count;l>0;l--)
	//{
//		te= te+out.str();
//	}

	return result;
}

int gmain() {

unsigned long long field =0xFFF19C7FFFFFFFFLLU;

unsigned long long ft=field;

unsigned long long area,area_prev,cp_area,cp_field;

unsigned long long first_one=0;

unsigned long long fi_area;



field=~field & 0x0FFFFFFFFFFFFFFFLLU;

cp_field=field;

string temp=convBase(cp_field, 2);
for (int i=0;i<temp.size();i++)
				{
				cout<< temp[i] <<"," ;

				if(((i+1) % 10==0)) cout<<endl;
				}
cout<<"ANSWER"<<endl<<endl;

while (area != 0)
	{
	ft=field;
	ft= ft& (ft-1);

	first_one=(field) ^ ft;
	area=first_one;
	area_prev=area+1;
	while (area_prev!=area)
		{
		area_prev=area;

		area = field & (area | ((area>>1) & 0xFFBFEFFBFEFFBFELLU ) | ((area<<1) & 0x7FDFF7FDFF7FDFFLLU)|((area>>10)&0x3FFFFFFFFFFFFLLU)| ((area<<10) & 0xFFFFFFFFFFFFC00LLU));



		}
	cp_area=area;
/*	string temp2=convBase(cp_area, 2);
	int j;
	for (int i=0;i<60-temp2.size();i++)
	{
		j=i;
						cout<< "0" <<"," ;

						if(((i+1) % 10==0)) cout<<endl;
						}


	for (unsigned int i=0;i<temp2.size();i++)
					{
					cout<< temp2[i] <<"," ;

					if(((i+j+2) % 10==0)) cout<<endl;
					}
     cout<<endl<<"NEXT"<<endl; */
	field=field -area;

	/*cout<<endl<<"FILD"<<endl;

	fi_area=0xFFBFEFFBFEFFBFELLU;
		string temp3=convBase(fi_area, 2);

		int jj;
		for (int ii=0;ii<60-temp3.size();ii++)
		{
			 jj=ii;
							cout<< "0" <<"," ;

							if(((ii+1) % 10==0)) cout<<endl;
							}

jj=0;
		for (unsigned int iiii=0;iiii<temp3.size();iiii++)
						{
						cout<< temp3[iiii] <<"," ;

						if(((iiii+jj+2) % 10==0)) cout<<endl;
						}

		cout<<endl<<"ENDFILD"<<endl;

*/
	}



	cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
	return 0;
}
